// http://www.daniweb.com/software-development/c/code/216919/implementing-string-trimming-ltrim-and-rtrim-in-c
#include <stdio.h>
#include <string.h>

#include "Trim.h"

#pragma code-name("DPCODE");
#pragma rodata-name("DPCODE");
#pragma data-name("DPCODE");

char* rtrim(char* string, char junk)
{
	char* original = string + strlen(string);
	while(*--original == junk);
	*(original + 1) = '\0';
	return string;
}

//char* ltrim(char *string, char junk)
//{
//	char* original = string;
//	char *p = original;
//	int trimmed = 0;
//	
//	do
//	{
//		if (*original != junk || trimmed)
//		{
//			trimmed = 1;
//			*p++ = *original;
//        }
//	}
//	
//	while (*original++ != '\0');
//	return string;
//}